import request from '@/utils/request'

// 创建仓库单据
export function createOrder(data) {
  return request({
    url: '/warehouse/order/create',
    method: 'post',
    data: data
  })
}

// 更新仓库单据
export function updateOrder(data) {
  return request({
    url: '/warehouse/order/update',
    method: 'put',
    data: data
  })
}

// 删除仓库单据
export function deleteOrder(id) {
  return request({
    url: '/warehouse/order/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除仓库单据 */
export function deleteOrderList(ids) {
  return request({
    url: `/warehouse/order/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得仓库单据
export function getOrder(id) {
  return request({
    url: '/warehouse/order/get?id=' + id,
    method: 'get'
  })
}

// 获得仓库单据分页
export function getOrderPage(params) {
  return request({
    url: '/warehouse/order/page',
    method: 'get',
    params
  })
}
// 导出仓库单据 Excel
export function exportOrderExcel(params) {
  return request({
    url: '/warehouse/order/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 出库入库
export function inOrOut(data) {
  return request({
    url: '/warehouse/order-material/inOrOut',
    method: 'put',
    data: data
  })
}


// 完结仓库单据
export function finish(data) {
  return request({
    url: '/warehouse/order/finish',
    method: 'post',
    data: data
  })
}


